www.gusucode.com > 智睿政府网站管理系统 V2.1.0 > 智睿政府网站管理系统 V2.1.0\code\manage\Admin_MeMEdit.asp

    <!--#include file="../Include/conn.asp"-->
<!--#include file="Admin_check.asp"-->
<!--#include file="../Include/Md5.asp"-->
<%
response.expires = 0 
response.expiresabsolute = now() - 1 
response.addHeader "pragma","no-cache" 
response.addHeader "cache-control","private" 
Response.cachecontrol = "no-cache"
if Instr(session("AdminPurview"),"|213,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  response.end
end if
'========判断是否具有管理权限 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<script language="javascript" src="images/Admin.js"></script>
<link href="images/Admin_css.css" type=text/css rel=stylesheet>
<title>留言中心</title></head>
<body>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,MemName,RealName,Password,vPassword,Sex,Zip,Telephone,UserMoney,Addess,Umail
ID=request.QueryString("ID")
call MemEdit() 
%>

<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
  <tr>
    <td height="24" nowrap><font color="#FFFFFF"><strong>网站会员:添加,修改会员</strong></font></td>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  bgcolor="#EBF2F9"><a href="Admin_MemEdit.asp?Result=Add" >添加新会员</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="Admin_MemList.asp">查看会员</a></td>    
  </tr>
</table>
<br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6298E1">
  <form name="editMemForm" method="post" action="?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" onSubmit="return CheckMemEdit()">
  <tr>
    <td height="24" nowrap bgcolor="#EBF2F9"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editProduct idth="100%">

      <tr>
        <td width="160" height="20" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="20" align="right">帐号:</td>
        <td><input name="MemName" type="text" class="textfield" id="MemName" style="WIDTH: 120;" value="<%=MemName%>" maxlength="16" <%if Result="Modify" then response.write ("readonly")%>>&nbsp;*&nbsp;3-16位字符,不可修改</td>
      </tr>
      <tr>
        <td height="20" align="right">真实姓名:</td>
        <td><input name="RealName" type="text" class="textfield" id="RealName" style="WIDTH: 120;" value="<%=RealName%>" maxlength="16"></td>
      </tr>
      <tr>
        <td height="20" align="right">密码:</td>
        <td><input name="Password" type="password" class="textfield" id="Password" maxlength="20" style="WIDTH: 120;">&nbsp;*&nbsp;6-16位字符,不填表未修改密码</td>
      </tr>
      <tr>
        <td height="20" align="right">确认密码:</td>
        <td><input name="vPassword" type="password" class="textfield" id="vPassword" maxlength="20" style="WIDTH: 120;">&nbsp;*</td>
      </tr>
      <tr>
        <td height="20" align="right">性别:</td>
        <td><input type="radio" name="sex" value="先生" <%if Sex="先生" then response.write ("checked")%>>&nbsp;先生&nbsp;<input type="radio" name="sex" value="女士" <%if Sex="女士" then response.write ("checked")%>>&nbsp;女士</td>
      </tr>
      <tr>
        <td height="20" align="right">地址:</td>
        <td><input name="Addess" type="text" class="textfield" id="Addess" style="WIDTH: 240;" value="<%=Addess%>" maxlength="100"></td>
      </tr>
      <tr>
        <td height="20" align="right">QQ/MSN:</td>
        <td><input name="Zip" type="text" class="textfield" id="Zip" style="WIDTH: 120;" value="<%=Zip%>" maxlength="16"></td>
      </tr>
      <tr>
        <td height="20" align="right">电话:</td>
        <td><input name="Telephone" type="text" class="textfield" id="Telephone" style="WIDTH: 240;" value="<%=Telephone%>" maxlength="50"></td>
      </tr>
      <tr>
        <td height="20" align="right">电子邮箱:</td>
        <td><input name="Umail" type="text" class="textfield" id="Umail" style="WIDTH: 240;" value="<%=Umail%>" maxlength="50"></td>
      </tr>
      <tr>
        <td height="20" align="right">积分:</td>
        <td><input name="UserMoney" type="text" class="textfield" id="UserMoney" style="WIDTH: 50;" value="<%=UserMoney%>" maxlength="10"></td>
      </tr>
      <tr>
        <td height="30" align="right">&nbsp;</td>
        <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
      <tr>
        <td height="20" align="right">&nbsp;</td>
        <td valign="bottom">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub MemEdit()
  dim Action,rsRepeat,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑管理员
    set rs = server.createobject("adodb.recordset")
    if Result="Add" then '创建网站管理员
      set rsRepeat = conn.execute("select MemName from zhi_rui_g_Users where MemName='" & trim(Request.Form("MemName")) & "'")
      if not (rsRepeat.bof and rsRepeat.eof) then '判断此管理员名是否存在
        response.write "<script language=javascript> alert('" & trim(Request.Form("MemName")) & "此会员名已经存在,请换一个登录名再试试!');history.back(-1);</script>"
        response.end
      end if 
	  sql="select * from zhi_rui_g_Users"
      rs.open sql,conn,1,3
      rs.addnew
      rs("MemName")=trim(Request.Form("MemName"))
      rs("RealName")=StrReplace(trim(Request.Form("RealName")))
      if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>16  then
        response.write "<script language=javascript> alert('会员密码必填,且字符数为6-16位!');history.back(-1);</script>"
        response.end
      end if
	  if Request.Form("Password")<>Request.Form("vPassword") then 
        response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
        response.end
	  end if
	  rs("Password")=Md5(Request.Form("Password"))
	  rs("Sex")=Request.Form("Sex")
	  rs("Addess")=StrReplace(trim(Request.Form("Addess")))
	  rs("Zip")=StrReplace(trim(Request.Form("Zip")))
	  rs("Telephone")=StrReplace(trim(Request.Form("Telephone")))
	  rs("Umail")=trim(Request.Form("Umail"))
	  if Request.Form("UserMoney")="" then
	  rs("UserMoney")=0
	  else
	  rs("UserMoney")=StrReplace(trim(Request.Form("UserMoney")))
	  end if
	  
	  rs("AddTime")=now()
	end if  
	if Result="Modify" then '修改网站管理员
      sql="select * from zhi_rui_g_Users where ID="&ID
      rs.open sql,conn,1,3
      rs("MemName")=trim(Request.Form("MemName"))
      rs("RealName")=StrReplace(trim(Request.Form("RealName")))
      if trim(Request.Form("Password"))<>"" then
	    if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>16  then
          response.write "<script language=javascript> alert('会员密码必填,且字符数为6-16位!');history.back(-1);</script>"
          response.end
        end if
	    if Request.Form("Password")<>Request.Form("vPassword") then 
          response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
          response.end
	    end if
	    rs("Password")=Md5(Request.Form("Password"))
	  end if
	  rs("Sex")=Request.Form("Sex")
	  rs("Addess")=StrReplace(trim(Request.Form("Addess")))
	  rs("Zip")=StrReplace(trim(Request.Form("Zip")))
	  rs("Telephone")=StrReplace(trim(Request.Form("Telephone")))
	  rs("Umail")=StrReplace(trim(Request.Form("Umail")))
	  rs("UserMoney")=StrReplace(trim(Request.Form("UserMoney")))
	end if
	rs.update
	rs.close
    set rs=nothing 
    response.write "<script language=javascript> alert('成功编辑网站会员!');location.replace('Admin_MemList.asp');</script>"
  else '提取管理员
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from zhi_rui_g_Users where ID="& ID
      rs.open sql,conn,1,1
	  MemName=rs("MemName")
	  RealName=rs("RealName")
	  Sex=rs("Sex")
	  Addess=rs("Addess")
	  Zip=rs("Zip")
	  Telephone=rs("Telephone")
	  Umail=rs("Umail")
	  UserMoney=rs("UserMoney")
	  rs.close
      set rs=nothing 
	end if
  end if
end sub
%>